/** @file
 * 
 */
#ifndef WII_GI_FLAGS_H
#define WII_GI_FLAGS_H

namespace wiigi
{
   /**
    * a simple class to manage bool type flags
    */
   template< typename T >
   class c_Flags
   {
      public:
         
         /**
          * constructor
          */
         c_Flags( void )
         {
            reset();
            return;
         }
         
         ~c_Flags()
         {
            return;
         }
         
         /**
          * reset all flags
          */
         void reset( void )
         {
            m_Flags = 0;
            return;
         }
         
         /**
          * Set the value of all the Flags
          * Overwrites all existing Flags.
          *
          * @param Flags New value of Flags
          */
         void setAllFlags(T Flags)
         {
            m_Flags = Flags;
            return;
         }
         
         /**
          * Set individual Flag(s).
          * Flag can be bit-wise OR'ed together to set
          * multiple Flags at the same time.
          *
          * @param Flag Flag to set.
          */
         void setFlag(T Flag)
         {
            m_Flags |= Flag;
         }
         
         /**
          * Clear individual Flag(s).
          * Flags can be bit-wise OR'ed together to clear
          * multiple Flags at the same time.
          *
          * @param Flag Attribute(s) to clear.
          */
         void clearFlag(T Flag)
         {
            m_Flags &= ~Flag;
         }   
         
         /**
          * Check the state of individual attribute(s).
          * Attributes can be bit-wise OR'ed together
          * and the method will return true if any are set.
          *
          * @param Flags Flag(s) to check.
          * @return true if the Flag(s) is set.
          */
         bool checkFlags(T Flags)
         {
            return (m_Flags & Flags) ? true : false;
         }
   
         /**
          * Check the state of multiple Flags.
          * Flags can be bit-wise OR'ed together
          * and the method will return true only if all the Flags are set.
          *
          * @param Flags Flags to check.
          * @return true if the Flags are set.
          */
         bool checkAllAttributes(T Flags)
         {
            return ((m_Flags & Flags) == Flags);
         }
           
      private:
         T  m_Flags;
   };      
             
}


#endif //WII_GI_FLAGS_H 
